import React from 'react';
import { Segmented as AntdSegmented } from 'antd';
import type { SegmentedProps as AntdSegmentedProps } from 'antd';
import { createStyles } from 'antd-style';

export interface SegmentedProps<T = any> extends AntdSegmentedProps<T> {
  /**
   * @description 自定义样式类名
   */
  customClassName?: string;
}

const useStyles = createStyles(({ token, css }) => ({
  segmented: css`
    border-radius: ${token.borderRadius}px;
  `,
}));

const Segmented = <T extends any = any>({ customClassName, className, ...restProps }: SegmentedProps<T>) => {
  const { styles, cx } = useStyles();
  
  const segmentedClassName = cx(
    className,
    customClassName,
    styles.segmented
  );

  return <AntdSegmented className={segmentedClassName} {...restProps} />;
};

export { Segmented };
export default Segmented;

